#pragma once
#include <pthread.h>

class Mutex
{
    public:
    Mutex(pthread_mutex_t* lock)
    :lock_(lock)
    {

    }
    void lock()
    {
        pthread_mutex_lock(lock_);

    }
    void unlock()
    {
        pthread_mutex_unlock(lock_);
    }
    ~Mutex()
    {

    }
    private:
    pthread_mutex_t* lock_;
};
class lockguard
{
    public:
    lockguard(pthread_mutex_t * lock):mutex_(lock)
    {
        mutex_.lock();
    }
    ~lockguard()
    {
        mutex_.unlock();
    }
    private:
    Mutex mutex_;
};